package org.spbsu.apco.common;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * User: solozobov
 * Date: 11.11.12
 */

/**
 * Service gives clients tasks and receives execution results
 */
@Path("/task")
public interface TaskService {
    /**
     * @param clientId id given to client during authorization {@link AuthorizationService#getId(int)}
     * @return task representation
     */
    @GET
    @Path("/gettask/{client-id}")
    @Produces(MediaType.WILDCARD)
    public byte[] getTask(@PathParam("client-id") final String clientId);

    /**
     * Holds task execution result
     * @param clientId id of client that returns task result
     * @param taskId id of completed task
     * @param data result representation
     */
    @POST
    @Path("/holdresult/{client-id}/{task-id}")
    @Consumes(MediaType.WILDCARD)
    public void holdResult(@PathParam("client-id") final String clientId,
                           @PathParam("task-id") final long taskId,
                           final byte[] data);
}
